#!/usr/bin/env python
#coding: utf-8
#
#多进程
from multiprocessing import Process #
from multiprocessing import Array #第二种共享方式
from multiprocessing import Manager #第三种共享方式
import time
array = Array('i',[11,22,33,44])

#方法一
def Foo(i):
	array[i] = 1000 + i
	for item in array:
		print item
	time.sleep(1)

#方法二
manage = Manager()
namespace = manage.Namespace()
namespace.x = [1,2,3,4]
def Foo2(i,dic):
	namespace.x = [1,2,3,i]
	print namespace

for i in range(4):
	p = Process(target=Foo,args=(i,))
	p.start()
